//
//  UnitSquareTextureMapper.cpp
//  Ray Tracer
//
//  Created by Kaila, Ashish on 3/23/13.
//  Copyright (c) 2013 Kaila, Ashish. All rights reserved.
//

#include "UnitSquareTextureMapper.h"
#include "../Utils/util.h"
#include "TextureMaterial.h"
#include "../Shapes/scene_object.h"
#include <stdlib.h>

bool UnitSquareTextureMapper::mapTexture(const Intersection& intersection, double& i, double& j) const
{
    i = j = 0;
    
    Point3D point = intersection.point;
    
    i = fabs(point[0]) - (int)abs(point[0]);
    j = fabs(point[1]) - (int)abs(point[1]);
    
    return true;
}